﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Net.Mail;
using System.Net.Mime;
using University.Workshop.Model;

namespace University.Workshop.Business
{
    public static class EmailSender
    {
        public static void SendEmail(string to, string displayName,string body)
        {
            if (string.IsNullOrEmpty(to) || string.IsNullOrEmpty(displayName) || string.IsNullOrEmpty(body))
                body = "";
            /*MailMessage m = new MailMessage();
            SmtpClient sc = new SmtpClient();
            try
            {
                m.From = new MailAddress("loqueseaecommerce@gmail.com", "loquesea ecommerce");
                m.To.Add(new MailAddress(to, displayName));
                //similarly BCC
                m.Subject = "Reminder Watch List";
                m.IsBodyHtml = true;
                m.Body = body;
                sc.Host = "smtp.gmail.com";
                sc.Port = 587;
                sc.Credentials = new
                System.Net.NetworkCredential("loqueseaecommerce@gmail.com", "loquesea123");
                sc.EnableSsl = true;
                sc.Send(m);

            }
            catch (ValidationException ex)
            {
                throw new ValidationException("The mail couldn't been sent", ex);
            }
            finally
            {
                if (m != null)
                {
                    m.Dispose();
                }
                if(  sc != null )
                {
                    sc.Dispose();
                }
            }*/
        }
    }
}
